package game.block.command;

import game.block.entity.Entity;
import game.block.entity.Wall;
import game.block.game.Board;
import game.block.tile.Tile;
import game.block.trap.WallTrigger;

public class WallMoveCommand extends Command{
    
    private Entity wall;
    private Board gameBoard;
    private WallTrigger trigger;
    private Tile tile;
    
    public WallMoveCommand(Tile tile, Board gameBoard, Wall wall, WallTrigger trigger) {
        this.wall = wall;
        this.gameBoard = gameBoard;
        this.trigger=trigger;
        this.tile=tile;
    }
    
    @Override
    public void execute() {
        tile.remove(trigger);
        gameBoard.getEntities().remove(wall);
        gameBoard.getEntities().remove(trigger);
        gameBoard.getTraps().remove(trigger);
    }

    @Override
    public void undo() {
        tile.add(trigger);
        gameBoard.getEntities().add(wall);
        gameBoard.getEntities().add(trigger);
        gameBoard.getTraps().add(trigger);
    }

}
